package com.sy.pet.controller.admin;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.sy.pet.commom.ResultBean;
import com.sy.pet.commom.enmu.AuditStatus;
import com.sy.pet.dto.PetAdoptionQueryDTO;
import com.sy.pet.dto.PetQueryDTO;
import com.sy.pet.service.PetAdoptionService;
import com.sy.pet.vo.PetAdoptionRecordVO;
import com.sy.pet.vo.PetVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: liangSY
 * @Date: 2024/9/17
 * @ClassName: PetAdoptionAdminController
 * @Description: PetAdoptionAdminController描述
 */
@RequestMapping("/admin/adoption")
@RestController
public class PetAdoptionAdminController {

    @Autowired
    PetAdoptionService petAdoptionService;

    @PostMapping("/page")
    private ResultBean<IPage<PetAdoptionRecordVO>> getPetList(@RequestBody PetAdoptionQueryDTO dto){
        IPage<PetAdoptionRecordVO> all = petAdoptionService.getPageData(dto);
        return ResultBean.success(all);
    }

    @PutMapping("/{id}/{status}")
    private ResultBean<IPage<PetAdoptionRecordVO>> getPetList(@PathVariable("id") String id,@PathVariable("status") AuditStatus status){
        petAdoptionService.audit(id,status);
        return ResultBean.success();
    }
}
